import asyncio

async def main():
    from services.ocb.handler import OcbHandler

    loop = asyncio.get_event_loop()

    handler = OcbHandler()
    # loop.create_task(handler.model.ocb_loop())
    loop.create_task(handler.model.ocb_currents_loop())
    for index in range(2):
        loop.create_task(handler.model.rm_loop(index))
        loop.create_task(handler.model.telemetry_reboot_rm(index))

    for index in range(4):
        loop.create_task(handler.model.sm_loop(index))
        loop.create_task(handler.model.telemetry_reboot_sm(index))

    loop.create_task(handler.model.sm_loop(4))

    await handler.receive_messages(loop)


if __name__ == '__main__':
    asyncio.new_event_loop()\
        .run_until_complete(main())

